
var mongoose = require("mongoose");
var dbhost = "123.56.117.43";
var dbport = 27017;
var dbname = "wh2004";
var dbuser = "hjz"
var dbpass = "missyou"

var db_conn_str =  `mongodb://${dbuser}:${dbpass}@${dbhost}:${dbport}/${dbname}`;

mongoose.connect(db_conn_str,{
    useNewUrlParser:true,
    useUnifiedTopology:true
},function(err){
    if(err){
        console.log("数据库连接失败....")
    }else{
        console.log("数据库连接成功....")
    }
})

const connection = mongoose.connection;

module.exports = connection